package su2010.puz.impl;

import java.awt.Image;
import java.awt.image.BufferedImage;

import com.matthewtavares.jipt.processing.CannyEdgeDetector;
import com.matthewtavares.jipt.processing.ImageOperator;

import su2010.puz.Filter;
import su2010.puz.ImageHelper;

/**
 * Edge detection by using Canny edge detector implementation from JIPT
 * (http://sourceforge.net/projects/jipt/)
 * @author Mateja
 *
 */
public class CannyEdgeFilter implements Filter {

	private int offset;
	
	public CannyEdgeFilter() {
		this.offset = 3;
	}
	
	@Override
	public BufferedImage apply(BufferedImage img) {
		ImageOperator canny =  new CannyEdgeDetector();
		Image image = canny.transform(img);
		return ImageHelper.getBufferedImage(image,offset);
	}

}
